gusucode.com > 现代通信系统——使用MATLAB(+全部程序) > 现代通信系统——使用MATLAB(+全部程序)/现代通信系统——使用MATLAB(+全部程序)/Matlab 程序/Chapter4/Entropy2.m

    function h=entropy2(p)
% h=entropy2(p) Returns the binary entropy function of the components 
%		of the vevtor p.
h=-p.*log2(p)-(1-p).*log2(1-p);